package cn.funnyxb.tools.appFrame.database;

import android.database.Cursor;
import cn.funnyxb.tools.appFrame.App;
import cn.funnyxb.tools.appFrame.debugTool.Debuger;

public abstract class TableHolder
{
  protected DBHolder dbHolder;
  protected String tableName;

  public TableHolder(DBHolder paramDBHolder, String paramString)
  {
    this.dbHolder = paramDBHolder;
    this.tableName = paramString;
  }

  private void log(String paramString)
  {
    Debuger.log("tbHolder", paramString);
  }

  private void prepareDbHolder()
  {
    if (this.dbHolder != null)
      return;
    this.dbHolder = App.getApp().getDBHolder();
  }

  public boolean clear()
  {
    if (this.dbHolder == null);
    for (int i = 0; ; i = 1)
    {
      return i;
      this.dbHolder.getDbService().execSql("delete from " + this.tableName);
    }
  }

  public DBHolder getDbHolder()
  {
    return this.dbHolder;
  }

  public String getTableName()
  {
    return this.tableName;
  }

  public Cursor queryAll()
  {
    prepareDbHolder();
    if (this.dbHolder == null)
      log("get DBHolder failed");
    for (Cursor localCursor = null; ; localCursor = this.dbHolder.dbService.query("select * from [" + this.tableName + "]", null))
      while (true)
      {
        return localCursor;
        if (!(this.tableName.startsWith("[")))
          break;
        localCursor = this.dbHolder.dbService.query("select * from " + this.tableName, null);
      }
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.tools.appFrame.database.TableHolder
 * JD-Core Version:    0.5.3
 */